How to Use Interactive Help

The SmartHub Helper Bot assists users with their search results.

For example, if a user gets no results returned to their query, the Bot might suggest popular alternatives (gathered from analytics) that are similar to what the user initially searched for. 

 

About the Helper Bot

The SmartHub Helper Bot or "ChatBot" enables users to interact with SmartHub to quickly navigate and refine your queries.

Helper Bot Functionality

The Helper Bot provides the following options:

  • Provides suggestions:
    • Provides suggestions to partially-typed queries.
    • For example, type "ad", and the Bot suggests "admin".
  • Corrects queries for misspelled words:


  • Suggests you remove filters that return no results:


  • Suggests you modify your query if too many results are returned or if your query is too long:


  • Suggests you filter your results if too many results are returned:



  • Suggests removing your filter if it returns no results:


  • Set to Automatically Trigger: You can set the Bot to automatically trigger if:
    • You open a specific web page on your site
    • You stay on a page for a set period.

User's First Chat with the Bot

  1. Start interacting with the Bot by clicking Need any assistance? on the bottom right side of the page:


  2. See the expanded chat window:


  3. Click the chat bubbles icon in the top right of the Bot window to refresh the chat bubble.

  4. Click "I didn't find what I need!" to bring up the Personalization dialogue for more options to fine tune your query.


Too Many Results Returned - Filter Suggested

After some time without any user interaction, or after the user reaches a certain page, the Bot might suggest applying popular filters recorded with Analytics.

  1. The Bot window expands and displays the filters for the results.
  2. Filter your results by clicking one or more filters.


  3. At any time, dismiss the Bot to return the Bot to the side.
  4. Similarly, for a search query such as "sharepoint", the Bot might suggest a more specific query text based on analytics:


Bot Suggestions if User Pauses or Reaches End of Page

After some time without any user interaction or if the user scrolls at the end of the page, the Bot might suggest tuning your search.


  1. Select "I didn't find what I need."
    Based on the number of the displayed results, the bot does either of the following:

    1. Opens the personalization panel

    2. Suggests other similar queries run with success by other users

No Results Returned

If no results are returned, the Bot tries the following:

  1. Checking the query text for misspelled words using a word dictionary.
    1. For example, if the query is "directionas".


  2. If there are no query results or the query text appears to be incorrect, but some filters are active, the Bot suggests removing some filters in order to obtain results:


  3. If steps 1 and 2 fail (or are not applicable) then the Bot searches analytics for a common query term that is close to the original query term:
    1. For example, if the query is "shaerpoint" the Bot would show:

How the Bot Uses Short-term Memory

The Bot enables the user to ask many natural language questions in sequence and it uses the current conversation context to understand and process the query.

Examples

User's 1st question:  What are the open cases for Contoso?

  • This question contains all the necessary information for the Bot to understand it: it has a subject: cases, case status: open, customer name: Contoso
  • The question intent can be resolved and the Bot can list the results of its search.

User's 2nd question: Which ones are P1?

  • This question is clearly missing the subject of the question while providing the priority (“P1”); this cannot be understood by the Bot unless there is context.
  • The Bot reuses the context determined by the previous question to process the current question.
  • As a result, the Bot filters the results previously displayed by priority "P1."

User's 3rd question: How about BA Insight?

  • This question is missing the subject, but the value for the customer entity has changed.
  • The Bot reuses the context determined by the previously run questions and updates it with the newly found information: customer name changed to "BA Insight."
    • The Bot understands this to mean it should display results about P1 open cases submitted by BA Insight

Conversation Context Behavior

  • The conversation context is cleared out if the user refreshes the page.
  • The conversation context is updated if the user switches from one subject to another.

How to Configure the Bot

Before continuing, familiarize yourself with the information in the topic How to Customize Your SmartHub User Interface.

  • To configure the Bot, copy the parameters around line 306 under SH.Bot.DefaultSettings in the file DefaultModuleSettings.js located in the directory <SmartHub_install_dir>\modules\SmartHubResourceLoader.

  • Paste these settings into your page's custom settings file (such as "CustomResultsPageSettings.js") and modify the parameters from there.

  • Use the following table of Bot Parameters:

Parameters

Setting Default Value Description
BotDisabled false

false: Bot is enabled 

true: Bot is disabled (leave BotDisabled on false if you still need the Promoted Results and Spell checking functionality)

BotDisabledOnLanding false

false: Bot is enabled on landing page (Index.html)

true: Bot is disabled on landing page

hideBot false

false: Bot is displayed on page

true: Bot is in silent mode (keeps Promoted Results and Spell checking functionality, but bot Container is not displayed on page)

userNameProperty preferedname The user profile property that will be used by the Bot
analyticsRefinerSuggestionNoOfSuggestions 5 Number of refiner suggestions to show
analyticsRelevantQueriesMinimumShouldMatch 75% Similarity minimum percentage for suggesting a new query

irrelevantResultPopupDisabledWhenReachingPageBottom

false

false: When scrolling to the Bottom of the page the irrelevant results pop up will show up

true: Irrelevant results pop up is disabled and will never appear

analyticsKeyPressDelay

300 Value is in milliseconds. The time to wait before trying to suggest a query in the chat Bot search box

STMDisabled

false

false: Bot short term memory is enabled

true: Bot short term memory is disabled

optionsPosition

'left'

'left': the options provided by the Bot are on the left side

'right': the options provided by the Bot are on the right side

pickedOptionPosition 'right'

'left': the selected option is on the left side

'right': the selected option is on the right side

collapsedOnLanding true

true: Bot stays collapsed when reaching the landing page

false: Bot expands when reaching the landing page

defaultUserNickName human

This is how the bot addresses the user (with no authentication).

Normally, the authentication name is used.

BotName SH.Bot This is how the bot introduces itself.
BotTemplatePath /modules/ChatBot/fwk/template.html The path to the bot window underscore template.
UserProfileServiceURL /Services/UserProfileService.svc The URL for the user profile service (required for analytics).
tooManyResultsRightSiblingSelector .CoveoResult:nth-child(6) Where the Bot window moves when events are triggered (too many results).
noResultsResultsRightSiblingSelector .CoveoExportToExcel Where the Bot window moves when events are triggered (no results).
minNumberOfResultsForTooManyResultsNthPage 1000 The minimum number of results required for the Bot to give a too many results suggestion if the user has reached the tooManyResultsPage.
tooManyResultsPage 2z The results page the user has to be on when the Bot gives a too many results suggestion (if there are more results than minNumberOfResultsForTooManyResultsNthPage)
tooManyResultsWaitTimeSeconds 60 The amount of time (that the user is inactive) before the Bot gives a too many results suggestion.
analyticsRefinerSuggestionAlgorithmId Refined2 The algorithm (query) used by analytics to determine refiner suggestions.
analyticsFuzzyMatchAlgorithmId The algorithm (query) used by analytics to determine a similar query (in the case of no results).
analyticsUserPastQueries 3 The maximum number of past queries required for the Bot to give Resume where I left off suggestions.
maxCorrectionDistance 2
  • The maximum string distance between two queries that enables the spell checked query from the Federator service to be suggested.
    • For example: With a string distance of 1:
      • After the query "csr" the Bot suggests "car,"
      • After query "bakkpakk," the Bot does not suggest "backpack" because the distance is too far.
  • Keeping this value low enables the Bot to consider a similar query from analytics rather than always giving the closest match based on the federator spellcheck service.
templatePaths
  • Everything the Bot says can be customized though templates
  • templatePaths is a mapping to the path of each template file on the disk.
  • Entering default sets the value to:
    /modules/ChatBot/templates/<the name of the template>.html.
  • To change a Bot template file, duplicate the default one, make your changes, and set the path in your Custom Settings file.
    1. For instance, to change the introductory message of the Bot:
      1. Duplicate (copy and paste) the file introMessageTemplate.html located at the path /modules/ChatBot/templates.
      2. Change the introductory text as you desire.
      3. Save the new template as myCustomIntroMessageTemplate.html.

Finally, set the new path in your custom settings page:

Copy
SH.Bot.CustomSettings = {
  templatePaths: {
    linkTemplate: '/modules/ChatBot/templates/myCustomIntroMessageTemplate.html'
  }
};

To remove one of the options the Bot says, use SH.Bot.PathsToExclude and exclude the template path.

For instance, to remove the 'change nickname' option, add its path to SH.Bot.PathsToExclude in your custom settings page:

Copy
SH.Bot.PathsToExclude = [
    ['templatePaths','mainMenuChangeNameOptionTemplate']
];

How to Select what the ChatBot Displays

The options displayed by Bot can be configured via the DefaultModuleSettings.js file located in the directory \modules\SmartHubResourceLoader\.

Copy
botActions: {
            'ResumeWork': {
                'label': 'Resume where I left off'.toLocaleString(),
                'jsEvaluator': 'EnableResumeWorkAction',
                'jsHandler': 'ExecuteResumeWorkAction',
                'disabled': false,
                'position': 1
            },
            'GetUpdatesForSavedQueries': {
                'label': 'See new documents for my saved queries'.toLocaleString(),
                'jsEvaluator': 'EnableUpdatesForSavedQueries',
                'jsHandler': 'ExecuteUpdatesForSavedQueries',
                'disabled': false,
                'position': 2
            },

            'TooManyResults': {
                'label': 'I see too many results!'.toLocaleString(),
                'jsEvaluator': 'EnableTooManyResultsAction',
                'jsHandler': 'ExecuteTooManyResultsAction',
                'disabled': false,
                'position': 6
            },
            'BadResults': {
                'label': "I didn't find what I need!".toLocaleString(),
                'jsEvaluator': 'EnableBadResultsAction',
                'jsHandler': 'ExecuteBadResultssAction',
                'disabled': false,
                'position': 7
            },
        },

 

Setting Description
label This value appears in ChatBot.
jsEvaluator

JavaScript function implemented in the SH.Bot.Actions namespace or exposed in window.

  • The bool function decide weather the option should be displayed in Bot or not based on some conditions.

  • For example, Resume where I left off option is displayed on the Landing page, but not on the Results page.

jsHandler

This function defines the ChatBot behavior once the user selects the option.

  • JavaScript function implemented in the SH.Bot.Actions namespace or exposed in window.

  • ExamplechangePreferences opens the personalization panel.

Copy
function ExecuteChangePreferencesAction(){
        if (SH.Bot.fwk.BotMode() != 'standalone')
        collapseBot(null, true);



        const templateParams = objOf('name', getSavedOrLoggedInName())
        const mainMenuGreeting = template(SH.Bot.templates.checkOpenPanelMessage)(templateParams)

        say(mainMenuGreeting);
        var prefTabDetails = {}
        prefTabDetails.id = 'changePreferences';
        prefTabDetails.label = 'Preferences';
        prefTabDetails.jsCode = 'DisplayEditPreferences';
        
        SH.Personalization.Show([prefTabDetails]);
    }
disabled
  • Disables the option from ChatBot.

  • Bool value

position
  • Sets the option position in the ChatBot option list.

  • Integer value

How to Disable the ChatBot (Prevent it From Loading)

To disable the ChatBot you set the BotDisabled parameter to true.

Use the following steps to perform this action:

  1. Navigate to the custom settings file that is associated with the page you are disabling the Bot for.
    1. Results Page Example:
      1. For the Results page, your custom HTML file is ResultsCopy.html.
      2. The associated settings file is ResultsCopyCustomSettings.js.
    2. Index Page Example:
      1. For the Index page, your custom HTML file is IndexCopy.html.
      2. The associated settings file is IndexCopyCustomSettings.js.
  2. Open the component's settings, located around line 306 in "\modules\SmartHubResourceLoader\DefaultModuleSettings.js".
  3. Copy the setting you want to change, in this case, BotDisabled
  4. Paste the setting into your custom Index settings file on the line where the component setting is located, around line 130 in this case.
    For more information, see How to Customize Your SmartHub User Interface.
  5. Below is a screenshot of our custom Index settings file.
    The BotDisabled setting is set to "true."  


  6. The ChatBot will NOT load as a result of this setting.
    1. Changing the setting to "false" reverses the behavior.

How to Remove the Bot from a Page

For more information, see How to Customize Your SmartHub User Interface.

  1. Navigate to the custom settings file that is associated with the page you are disabling the bot for.
  2. Update the PathsToExclude parameter with the path to the file "ChatBot.js", shown in the code block below:

    1. In the IndexCopyCustomSettings.js file, this is around line 15.

    Copy
    SH.Loader.PathsToExclude = [
        "/modules/ChatBot/ChatBot.js"    /*
            ['/modules/Analytics/AnalyticsLoader.js', 'params', 'id'],
            ['/modules/Ribbon/ribbon.css']
        */
    ];
  3. Save the file and close it.